home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / ubas830.zip / MALM.EXE / POLPM1.UB < prev    next >
Text File  |  1990-08-22  |  497b  |  14 lines

  1.    10   *Polpm1(N,B,Ubnd,&F,&G)
  2.    20   ' Pollard p-1 method of factoring n using base b.
  3.    30   ' Based upon the Pascal version.  16 April 1990.
  4.    50   local Cc%=20,Count=3,I%=0,T
  5.    60   if N<2 then F=0;G=0; return endif
  6.    70   B=modpow(B,4,N)
  7.    80   while Count<Ubnd
  8.    90   B=modpow(B,Count,N):inc I%
  9.   100   if I%@Cc%=0 then I=0:T=gcd(B-1,N)
  10.   110   :if T>1 then F=T:G=N\F:return endif endif
  11.   120   inc Count
  12.   130   wend
  13.   140   F=-1:G=-1:return ' End of Subroutine Polpm1
  14.